<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2017/6/30
 * Time: 11:26
 */

namespace ElementVip\JwOms\Handler;

use ElementVip\JwOms\Services\GoodsService;

class GoodsHandle extends AbstractOms
{
    protected $goodsService;

    public function __construct(GoodsService $goodsService)
    {
        $this->goodsService = $goodsService;
    }

    public function handle()
    {
        //同步库存
        \Log::info('进入了同步库存');
        if (count($file = $this->downloadFiles('Stock')) > 0) {
            foreach ($file as $item) {
                $this->goodsService->syncStock($item, 'Stock');
            }
        }else{
            \Log::info('未同步任何库存');
        }
    }

}